package com.app.bimo.library_db;

import org.greenrobot.greendao.annotation.Convert;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;

import java.util.List;

import androidx.annotation.NonNull;

/**
 * 阅读记录  每次阅读都记录  用于数据上报
 */
@Entity
public class ReadTimeRecord {

    @Id(autoincrement = true)
    private Long id;
    private String novelid;
    private String uuid;
    @Convert(columnType = String.class, converter = ReadChapterRecordConvert.class)
    private List<ReadChapterRecord> chapter;
    private long creatTime;
    private long endTime;
    /**
     * 状态  0 未上报  1已上报   2 成功上报
     */
    private int status;


    @Generated(hash = 1366049267)
    public ReadTimeRecord(Long id, String novelid, String uuid, List<ReadChapterRecord> chapter, long creatTime, long endTime, int status) {
        this.id = id;
        this.novelid = novelid;
        this.uuid = uuid;
        this.chapter = chapter;
        this.creatTime = creatTime;
        this.endTime = endTime;
        this.status = status;
    }

    @Generated(hash = 1105473087)
    public ReadTimeRecord() {
    }


    public String getUuid() {
        return this.uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getNovelid() {
        return this.novelid;
    }

    public void setNovelid(String novelid) {
        this.novelid = novelid;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<ReadChapterRecord> getChapter() {
        return this.chapter;
    }

    public void setChapter(List<ReadChapterRecord> chapter) {
        this.chapter = chapter;
    }

    public long getCreatTime() {
        return this.creatTime;
    }

    public void setCreatTime(long creatTime) {
        this.creatTime = creatTime;
    }

    public long getEndTime() {
        return this.endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public int getStatus() {
        return this.status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @NonNull
    @Override
    public String toString() {
        return "ReadRecordUtil--uid=" + uuid + "--id=" + id + "--novelid=" + novelid + "--creatTime=" + creatTime + "--endTime=" + endTime + "-间隔--" + (endTime - creatTime) + "--status=" + status + "--chapter=" + chapter.size();
    }
}
